<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix" style="text-align: center;line-height: 30px">
        <h3>查看客户信息</h3>
      </div>

      <div class="text item">
        <el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">

          <el-row>
            <el-col :span="12"><div class="grid-content bg-purple">
              <el-form-item label="客户名称" prop="name">
                <el-input v-model="ruleForm.name"></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="12"><div class="grid-content bg-purple-light">
              <el-form-item label="负责人" prop="name">
                <el-input v-model="ruleForm.mainperson"></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <br>

          <el-row>
            <el-col :span="12"><div class="grid-content bg-purple">
              <el-form-item label="负责人电话" prop="name">
                <el-input v-model="ruleForm.tel"></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="12"><div class="grid-content bg-purple-light">
              <el-form-item label="办公地址" prop="name">
                <el-input v-model="ruleForm.address"></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <br>

          <el-row>
            <el-col :span="12"><div class="grid-content bg-purple">
              <el-form-item label="邮箱" prop="name">
                <el-input v-model="ruleForm.email"></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="12"><div class="grid-content bg-purple-light">
              <el-form-item label="经营范围">
                <el-input type="textarea" v-model="ruleForm.scope"></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <br>

          <el-row>
            <div style="text-align: center">
              <el-form-item>
                <el-button type="primary" @click="onSubmit">确定</el-button>
              </el-form-item>
            </div>
          </el-row>
        </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "SelectClient",
  props:{
    buyId:JSON
  },
  data(){
    return{
      ruleForm:{
        name:'',
        mainperson:'',
        tel:'',
        address:'',
        email:'',
        scope:''
      }
    }
  },
  mounted() {
    this.init()
  },
  methods:{
    init(){
      console.log(this.buyId)
      let url = 'apj/client/selectOneClient/'+this.buyId.clientName
      this.$axios.get(url).then(r=>{
        let datas = r.data
        this.ruleForm.name = datas.clientName
        this.ruleForm.mainperson = datas.mainPerson
        this.ruleForm.tel = datas.mainpersonTel
        this.ruleForm.address = datas.clientAddress
        this.ruleForm.email = datas.clientEmail
        this.ruleForm.scope = datas.lientScop
      })
    },
    onSubmit() {
      this.$emit("close")
    }
  }
}
</script>

<style scoped>

</style>